clear
import excel "C:\Papers\New papers\John Cronyism\Italy\List.xlsx", sheet("List") firstrow
drop LinkBalanceSheet LinkDirectors
rename IdOrigine id
save "C:\Papers\New papers\John Cronyism\Italy\List.dta", replace
clear

clear
import excel "C:\Papers\New papers\John Cronyism\Italy\Costo della vita numeri indice.xlsx", sheet("Sheet1") firstrow
drop  SourceISTATIlvaloredella 
save "C:\Papers\New papers\John Cronyism\Italy\Cost of Living.dta", replace
clear

/*This file contains the names of deputies of the XXVII legislature who served on Consulta or Costituente and, as such, remain eligible*/
clear
import excel "C:\Papers\New papers\John Cronyism\Italy\Deputati XXVII who served on Consulta or Costituente.xlsx", sheet("Sheet1") firstrow
gen DeputatiEligibile=1
save "C:\Papers\New papers\John Cronyism\Italy\Deputati XXVII who served on Consulta or Costituente.dta", replace
clear


clear
import excel "C:\Papers\New papers\John Cronyism\Italy\SenatoOnlyCleaned.xlsx", sheet("Sheet1") firstrow
summarize
rename LASTNAMEFirstName Nome
replace Nome=upper(Nome)
duplicates drop Nome, force
/*These commands are to build the variable FascistbasedoncourtsPFY, which denotes whether the senator in question was found guilty in court of law of playing major role in fascism, 0 denotes no guilty or not prosecuted for a variety of reasons. PFY stand for person, firm, and year*/
rename Fascistbasedoncourts FascistbasedoncourtsPFY
tabulate FascistbasedoncourtsPFY
gen New=1 if FascistbasedoncourtsPFY=="1"
replace New=0 if FascistbasedoncourtsPFY=="0"|FascistbasedoncourtsPFY=="Died before collapse of fascism"|FascistbasedoncourtsPFY=="Died before fascism"|FascistbasedoncourtsPFY=="Died before trial/verdict"|FascistbasedoncourtsPFY=="Missing in action"|FascistbasedoncourtsPFY=="Resigned"
drop FascistbasedoncourtsPFY
rename New FascistbasedoncourtsPFY
replace FascistbasedoncourtsPFY=0 if  FascistbasedoncourtsPFY==.
/* The commands below are to build the variable FascistWikipediaorInternetPFY which denotes whether a senator is classified as fascist based on searches in Wikipedia. Those searches are run for senators that died before the fall of fascism and/or before being prosecuted. Those senators would otherwise be classified as non fascist generating possibly large attenuation bias*/
rename FascistWikipediaorInternet FascistWikipediaorInternetPFY
tabulate FascistWikipediaorInternetPFY
gen New=1 if FascistWikipediaorInternetPFY=="1"| FascistWikipediaorInternetPFY=="1?"
replace New=0 if FascistWikipediaorInternetPFY=="0"| FascistWikipediaorInternetPFY=="0?"
drop FascistWikipediaorInternetPFY
rename New FascistWikipediaorInternetPFY
replace FascistWikipediaorInternetPFY=0 if  FascistWikipediaorInternetPFY==.
/* The commands below are to build the variable Fascist_PNF_PFY which denotes whether the senator was registered to the PNF based on the documents assembled by the party, and 0 if not registered or not in the list*/
rename PNForUNF19371939 Fascist_PNF_PFY
replace Fascist_PNF_PFY =0 if Fascist_PNF_PFY==.
/* The commands below are to build an indicator, FascistSenatorPFY, denoting if the senator can be classified as fascist based on any of the three criteria considered*/
gen FascistSenatorPFY=max( Fascist_PNF_PFY, FascistbasedoncourtsPFY ,FascistWikipediaorInternetPFY)
/* Categoria21 denotes senators who were appointed because of the amount of taxes paid*/
replace Categoria21=0 if Categoria21==.
summarize
/* SenatorPFY denotes people who served as senators, regardless of when and regardless of their political affiliation*/
gen SenatorPFY=1
save "C:\Papers\New papers\John Cronyism\Italy\SenatoriOnlyCleaned.dta", replace
clear

/*START HERE*/
clear
import excel "C:\Papers\New papers\John Cronyism\Italy\DirCleanedMatchedWithPoliticians.xlsx", sheet("Sheet1") firstrow
drop if Organo!="Board of Directors"&Organo!="Consiglio d'Amministrazione"&Organo!="Direzione o Consiglio Direttivo"
tabulate Anno
gen T=1
replace T=2 if Anno==1913
replace T=3 if Anno==1921
replace T=4 if Anno==1927
replace T=5 if Anno==1936
replace T=6 if Anno==1941
replace T=7 if Anno==1946
replace T=8 if Anno==1952
replace T=9 if Anno==1960
replace T=10 if Anno==1972
replace T=11 if Anno==1983
drop if Anno==.
sort Nome
merge m:1 Nome using  "C:\Papers\New papers\John Cronyism\Italy\SenatoriOnlyCleaned.dta"
drop if _merge==2
drop _merge
summarize
tabulate Causeterminationpolitician
gen decadenza=0
replace decadenza=1 if Causeterminationpolitician=="cassazione della decadenza"
replace decadenza=1 if Causeterminationpolitician=="ordinanza di decadenza"
replace decadenza=1 if Causeterminationpolitician=="ordinanza di cassazione della decadenza"
replace decadenza=1 if Causeterminationpolitician=="Ordinanza di decadenza"
replace decadenza=1 if Causeterminationpolitician=="Ordine di decadenza"
replace decadenza=1 if Causeterminationpolitician=="sentenza di cassazione della decadenza"
replace decadenza=1 if Causeterminationpolitician=="Sentenza di cassazione della decadenza"
replace decadenza=1 if Causeterminationpolitician=="Sentenza di cassazione della decadenz"
replace decadenza=1 if Causeterminationpolitician=="Sentenza penale di condanna"
replace decadenza=1 if Causeterminationpolitician=="Ordinanza di riconoscimento delle circostanze per dichiarare la decadenza (postuma)"
replace decadenza=1 if Causeterminationpolitician=="Senatori che aderirono nel 1943 al governo della Repubblica Sociale"
replace decadenza=FascistbasedoncourtsPFY if decadenza!=1& FascistbasedoncourtsPFY!=.
replace FascistbasedoncourtsPFY=0 if FascistbasedoncourtsPFY==.
tabulate Nome if decadenza==1& FascistbasedoncourtsPFY==0
replace decadenza=1 if FascistbasedoncourtsPFY==1
replace FascistbasedoncourtsPFY=1 if decadenza==1
drop decadenza
/*these last changes were made because of different spelling of names (ancient Italian!) in directors file and politicians file, which were manually checked*/
replace PoliticianStartDate= PoliticianEndDate if PoliticianStartDate==.
replace PoliticianEndDate =PoliticianStartDate if PoliticianEndDate ==.
gen AfterA= Anno- PoliticianStartDate
gen Before= PoliticianEndDate- Anno
gen inPower=0
replace inPower=1 if (AfterA>=0&AfterA!=.)&( Before>0&Before!=.)
/*These last two steps are to ensure the person is in politics the year he is classified as politician in the time-series. So, now the variable becomes time-varying. We are assuming that board data are as of year end and politician ends term before year end, which is most likely*/
replace FascistbasedoncourtsPFY=0 if inPower==0
replace FascistbasedoncourtsPFY=. if Anno>1960
sort PersonCompanyID
by PersonCompanyID: egen IneligiblePF=max(FascistbasedoncourtsPFY)
summarize
replace IneligiblePF=. if Anno>1960
gen PoliticianQ=1 if Politician_Qualifica==1
replace Politician_SenatoFileOrQualifica=1 if PoliticianQ==1& Politician_SenatoFileOrQualifica!=2
replace Politician_SenatoFileOrQualifica=1 if SenatorPFY==1& Politician_SenatoFileOrQualifica!=2
replace Politician_SenatoFileOrQualifica =0 if inPower==0& Politician_SenatoFileOrQualifica!=2
replace Politician_SenatoFileOrQualifica=. if Anno>1960
drop PoliticianQ

sort PersonCompanyID
by PersonCompanyID: egen PoliticianPF=max(Politician_SenatoFileOrQualifica) if Politician_SenatoFileOrQualifica<2
replace PoliticianPF=0 if PoliticianPF==. 
replace PoliticianPF=. if Anno>1960

replace SenatorPFY=0 if SenatorPFY==.
replace SenatorPFY =0 if inPower==0
replace SenatorPFY =. if Anno>1960

sort PersonCompanyID
replace Fascist_PNF_PFY =0 if inPower==0
by PersonCompanyID: egen SenatorePNF_PF=max(Fascist_PNF_PFY)
replace SenatorePNF_PF=0 if SenatorePNF_PF==.
replace SenatorePNF_PF=. if Anno>1960

sort PersonCompanyID
replace FascistWikipediaorInternetPFY=0 if inPower==0
by PersonCompanyID: egen SenatoreFascistaAltroPF=max(FascistWikipediaorInternetPFY)
replace SenatoreFascistaAltroPF =0 if SenatoreFascistaAltroPF ==.
replace SenatoreFascistaAltroPF =. if Anno>1960

by PersonCompanyID: gen SenatoreFascistaPF=max(SenatoreFascistaAltroPF, SenatorePNF_PF, IneligiblePF)
replace SenatoreFascistaPF =0 if SenatoreFascistaPF ==.
replace SenatoreFascistaPF =. if Anno>1960

summarize
sort Nome
egen newid = group(Nome)
summarize newid
sort newid id
drop if Anno>1972
egen personfirmID = group(PersonCompanyID)
sort personfirmID T
duplicates drop personfirmID T, force

gen AfterAventino=0
replace AfterAventino=1 if Anno>1926
sort personfirmID
replace AventinoDisqualified1926=0 if AventinoDisqualified1926==.
by personfirmID: egen AventinoDisqualified1926PF=sum(AventinoDisqualified1926)
replace AventinoDisqualified1926PF=1 if AventinoDisqualified1926PF>0& AventinoDisqualified1926PF<100
gen DisqualifiedNF1926After= AventinoDisqualified1926PF* AfterAventino
replace DisqualifiedNF1926After=0 if DisqualifiedNF1926After==.
replace DisqualifiedNF1926After=. if Anno>1960
replace AventinoDisqualified1926=. if Anno>1960
replace DisqualifiedNF1926=. if Anno>1960
replace AventinoDisqualified1926PF=. if Anno>1960
replace DisqualifiedNF1926After=. if Anno>1960

sort id Anno
by id Anno: egen BoardSizeFY=count( Nome)
replace Politician_SenatoFileOrQualifica=0 if AventinoDisqualified1926==1&Anno>=1926&Anno<1946
sort id Anno
by id Anno: egen NumberConnFY=sum( Politician_SenatoFileOrQualifica)
replace NumberConnFY=. if Anno>1960
gen ConnectedDummyFY=0
summarize
replace ConnectedDummyFY=1 if NumberConnFY>0& NumberConnFY!=.
replace ConnectedDummyFY=. if Anno>1960
/*these latest replacements were done because the names of politicians were gathered only through 1963*/
summarize
gen lnBoardSizeFY=ln(BoardSizeFY)
sort Anno
by Anno: summarize Politician_SenatoFileOrQualifica  ConnectedDummyFY BoardSizeFY
sort Nome Anno
by Nome Anno: egen NumberOfBoardsPY=count(Nome)
/*This command generates an indicator denoting O&Ds who subsequently became politicians*/
gen OandD_Who_Became_Politician=1 if (PoliticianStartDate> Anno)& PoliticianStartDate!=.
replace OandD_Who_Became_Politician=0 if OandD_Who_Became_Politician==.
sort PersonCompanyID
by PersonCompanyID: egen mOandD_Who_Became_Politician =max(OandD_Who_Became_Politician)
drop OandD_Who_Became_Politician
rename mOandD_Who_Became_Politician OandD_Who_Became_Politician

/* This command creates indicator denoting O&Ds who subsequently became senators because of paying large amounts in taxes (i.e., "le persone, che da tre anni pagano tremila lire d'imposizione diretta in ragione de' loro beni, o della loro industria.)"*/
gen OandD_Appointed_As_Senator_Cat21=1 if (PoliticianStartDate> Anno)& Categoria21==1
replace OandD_Appointed_As_Senator_Cat21=0 if OandD_Appointed_As_Senator_Cat21==.
sort PersonCompanyID
by PersonCompanyID: egen mOandD_Appointed_As_Sen_Cat21=max(OandD_Appointed_As_Senator_Cat21)
drop OandD_Appointed_As_Senator_Cat21
rename mOandD_Appointed_As_Sen_Cat21 OandD_Appointed_As_Senator_Cat21
/* This command creates indicator denoting O&Ds who subsequently became senators for any reason but previously serving as members of the chamber of deputies*/
gen OandD_Appointed_As_Senator_All=1 if (PoliticianStartDate> Anno)& Category!="3"
replace OandD_Appointed_As_Senator_All=0 if Category==""
replace OandD_Appointed_As_Senator_All=0 if OandD_Appointed_As_Senator_All==.
sort PersonCompanyID
by PersonCompanyID: egen mOandD_Appointed_As_Sen_All=max(OandD_Appointed_As_Senator_All)
drop OandD_Appointed_As_Senator_All
rename mOandD_Appointed_As_Sen_All OandD_Appointed_As_Senator_All
/* This command creates indicator denoting O&Ds who subsequently became senators */
gen OandD_Appointed_As_Senator_All2=1 if (PoliticianStartDate> Anno) & Category!=""
replace OandD_Appointed_As_Senator_All2=0 if OandD_Appointed_As_Senator_All2==.
sort PersonCompanyID
by PersonCompanyID: egen mOandD_Appointed_As_Sen_All2=max(OandD_Appointed_As_Senator_All2)
drop OandD_Appointed_As_Senator_All2
rename mOandD_Appointed_As_Sen_All2 OandD_Appointed_As_Senator_All2

tsset personfirmID T
gen Eligible=0
replace Eligible=1 if Causeterminationpolitician== "Aventino"
replace Eligible=1 if Causeterminationpolitician== "Ordinanza di accoglimento del ricorso e revoca della decadenza"
replace Eligible=1 if Causeterminationpolitician== "revoca della decadenza"
replace Eligible=1 if Causeterminationpolitician== "rigetto decadenza"
replace Eligible=1 if Causeterminationpolitician== "rigetto della richiesta di decadenza"
replace Eligible=1 if Causeterminationpolitician== "rigetto della sentenza di decadenza"
sort PersonCompanyID
by PersonCompanyID: egen EligiblePF=max(Eligible)
replace EligiblePF =0 if EligiblePF ==.
replace EligiblePF=. if Anno>1960
replace Eligible =0 if inPower==0
replace Eligible =. if Anno>1960
gen After=0
replace After=1 if Anno>1943
gen IneligiblePFAfter= IneligiblePF*After
gen EligiblePFAfter= EligiblePF *After
replace IneligiblePFAfter=. if Anno>1960
replace EligiblePFAfter =. if Anno>1960
by PersonCompanyID: egen MussoliniOrCianoPF=max(MussoliniOrCiano)
replace MussoliniOrCianoPF =. if  Anno>1960
gen MussoliniOrCianoPFAfter = MussoliniOrCianoPF*After
merge m:1 Nome using  "C:\Papers\New papers\John Cronyism\Italy\Deputati XXVII who served on Consulta or Costituente.dta"
drop if _merge==2
drop _merge
gen FascistDeputyPFY= Politician_SenatoFileOrQualifica
replace FascistDeputyPFY=0 if SenatorPFY==1
replace FascistDeputyPFY=0 if Anno<1924|Anno>1943
replace FascistDeputyPFY=0 if inPower==0
replace FascistDeputyPFY=0 if AventinoDisqualified1926PF==1
replace FascistDeputyPFY=0 if DeputatiEligibile==1
replace FascistDeputyPFY=. if Anno>1960
sort personfirmID
by personfirmID: egen FascistDeputyPF=max(FascistDeputyPFY)
summarize
gen FascistDeputyPFAfter= FascistDeputyPF*After
replace FascistDeputyPFAfter=. if Anno>1960
replace FascistDeputyPF=0 if FascistDeputyPF==.
replace FascistDeputyPF =. if Anno>1960
replace FascistDeputyPFY =0 if FascistDeputyPFY==.
replace FascistDeputyPFY =. if Anno>1960
tsset personfirmID   T
sort personfirmID
by personfirmID: egen SenatorPF =max(SenatorPFY)
replace SenatorPF=0 if SenatorPF==.
replace SenatorPF =. if Anno>1960

gen SenatoreFAfter=SenatoreFascistaPF*After
replace SenatoreFAfter=. if Anno>1960
gen AventinoAfter=DisqualifiedNF1926After
replace AventinoAfter=0 if Anno<1946
replace FascistSenatorPFY=0 if FascistSenatorPFY==.
replace FascistSenatorPFY=. if Anno>1960
gen FascistaPFY=max(FascistSenatorPFY,FascistDeputyPFY)
replace FascistaPFY=0 if FascistaPFY==.
gen FascistaPF= max(SenatoreFascistaPF, FascistDeputyPF)
gen FascistaPFAfter=FascistaPF*After

tsset personfirmID T
gen mara=1
/*These commands generate the results in Table 4. Skip because they cannot be run with the little data included*/
/*reghdfe Politician_SenatoFileOrQualifica L.Politician_SenatoFileOrQualifica, absorb(i.id##i.T) cluster(Nome id)
est sto m1
reghdfe Politician_SenatoFileOrQualifica  FascistaPFAfter, absorb(personfirmID   i.T##i.id) cluster(Nome id)
est sto m2
reghdfe Politician_SenatoFileOrQualifica FascistDeputyPFAfter SenatoreFAfter  , absorb(personfirmID i.T##i.id) cluster(Nome id)
est sto m3	
reghdfe Politician_SenatoFileOrQualifica  FascistDeputyPFAfter IneligiblePFAfter EligiblePFAfter, absorb(personfirmID   i.T##i.id) cluster(Nome id)
est sto m4
reghdfe Politician_SenatoFileOrQualifica  FascistDeputyPFAfter IneligiblePFAfter EligiblePFAfter DisqualifiedNF1926After AventinoAfter, absorb(personfirmID i.T##i.id ) cluster(Nome id)
est sto m5
esttab m1 m2 m3 m4 m5, se(3) star( * 0.1 ** 0.05 *** 0.01) scalar(F) r2 b ar2 b(4) nogap
esttab m1 m2 m3 m4 m5 using "C:\Papers\New papers\John Cronyism\Italy\Table4.csv", replace starl( * 0.10 ** 0.05 *** 0.010) stats(N r2 ar2)  se(3) b(3) nogap
eststo clear*/

sort personfirmID T
gen Kept=1 if F.personfirmID!=.
replace Kept=0 if F.personfirmID ==.&Kept!=1
gen Departed=1-Kept
sort id Anno
gen FascistaDepartedPFY= FascistaPF*Departed if FascistaPF>0& FascistaPF<=1
gen FascistaKeptPFY= FascistaPF*Kept if FascistaPF>0& FascistaPF<=1
gen OandD_Who_Became_FascPol= OandD_Who_Became_Politician* FascistaPF
gen OandD_Who_Bec_FascPol_After= OandD_Who_Became_FascPol*After
gen OandD_Who_Became_Pol_After= OandD_Who_Became_Politician*After
/*These commands generate the results in Table 5*/
/*Test run to see if more likely to be fired when political office is lost*/
reghdfe Departed Politician_SenatoFileOrQualifica  FascistaPF FascistaPFAfter, absorb( i.T##i.id) cluster(Nome id)
est sto m1
reghdfe Departed OandD_Who_Became_Politician OandD_Who_Became_Pol_After Politician_SenatoFileOrQualifica  FascistaPF FascistaPFAfter, absorb( i.T##i.id) cluster(Nome id)
est sto m2

esttab m1  m2, se star( * 0.1 ** 0.05 *** 0.01) scalar(F) r2 b ar2 b(4) nogap
esttab m1 m2 using "C:\Papers\New papers\John Cronyism\Italy\Table5.csv", replace starl( * 0.10 ** 0.05 *** 0.010) stats(N r2 ar2)  se(3) b(3) nogap
eststo clear

save "C:\Papers\New papers\John Cronyism\Italy\ConnectionsPreCollapse.dta", replace
clear


clear
use "C:\Papers\New papers\John Cronyism\Italy\ConnectionsPreCollapse.dta", clear
collapse AventinoDisqualified1926 BoardSizeFY ConnectedDummyFY T    Fascist_PNF_PFY FascistbasedoncourtsPFY FascistWikipediaorInternetPFY FascistSenatorPFY SenatorPFY AfterA Before inPower IneligiblePF SenatorePNF_PF SenatoreFascistaAltroPF SenatoreFascistaPF AfterAventino AventinoDisqualified1926PF DisqualifiedNF1926After NumberConnFY lnBoardSizeFY NumberOfBoardsPY Eligible After IneligiblePFAfter EligiblePFAfter FascistDeputyPFY FascistDeputyPF FascistDeputyPFAfter FascistaPFY FascistaPF FascistaPFAfter      SenatoreFAfter  AventinoAfter   Politician_SenatoFileOrQualifica   Categoria21  MussoliniOrCiano OandD_Appointed_As_Senator_Cat21 OandD_Appointed_As_Senator_All OandD_Appointed_As_Senator_All2 OandD_Who_Became_Politician FascistaDeparted FascistaKeptPFY OandD_Who_Became_FascPol OandD_Who_Bec_FascPol_After OandD_Who_Became_Pol_After, by(Nome Anno)

sort Nome
encode Nome, generate(ID)
by Nome: egen FascistaN=max(FascistaPF)
drop if FascistaN!=0& FascistaN!=1
rename FascistaN FascistaP
gen FascistaPAfter = FascistaP*After
tabulate Politician_SenatoFileOrQualifica
drop if Politician_SenatoFileOrQualifica!=0& Politician_SenatoFileOrQualifica!=1
tsset ID T
save "C:\Papers\New papers\John Cronyism\Italy\ConnectionsIndividualLevel.dta", replace
clear

clear
use "C:\Papers\New papers\John Cronyism\Italy\ConnectionsPreCollapse.dta", clear
collapse AventinoDisqualified1926 BoardSizeFY ConnectedDummyFY T    Fascist_PNF_PFY FascistbasedoncourtsPFY FascistWikipediaorInternetPFY FascistSenatorPFY SenatorPFY AfterA Before inPower IneligiblePF SenatorePNF_PF SenatoreFascistaAltroPF SenatoreFascistaPF AfterAventino AventinoDisqualified1926PF DisqualifiedNF1926After NumberConnFY lnBoardSizeFY NumberOfBoardsPY Eligible After IneligiblePFAfter EligiblePFAfter FascistDeputyPFY FascistDeputyPF FascistDeputyPFAfter FascistaPFY FascistaPF FascistaPFAfter        SenatoreFAfter  AventinoAfter   Politician_SenatoFileOrQualifica   Categoria21  MussoliniOrCiano OandD_Appointed_As_Senator_Cat21 OandD_Appointed_As_Senator_All OandD_Appointed_As_Senator_All2 OandD_Who_Became_Politician FascistaDeparted FascistaKeptPFY OandD_Who_Became_FascPol OandD_Who_Bec_FascPol_After OandD_Who_Became_Pol_After, by(id Anno)
/*These commands are to build time-invariant firm-level indicators*/
replace AventinoAfter=1 if AventinoAfter>0& AventinoAfter<1
replace OandD_Appointed_As_Senator_Cat21=0 if OandD_Appointed_As_Senator_Cat21==.
replace OandD_Appointed_As_Senator_Cat21=1 if OandD_Appointed_As_Senator_Cat21>0& OandD_Appointed_As_Senator_Cat21<1
replace OandD_Appointed_As_Senator_All=0 if OandD_Appointed_As_Senator_All==.
replace OandD_Appointed_As_Senator_All=1 if OandD_Appointed_As_Senator_All>0& OandD_Appointed_As_Senator_All<1
replace OandD_Appointed_As_Senator_All2=0 if OandD_Appointed_As_Senator_All2==.
replace OandD_Appointed_As_Senator_All2=1 if OandD_Appointed_As_Senator_All2>0& OandD_Appointed_As_Senator_All2<1
replace OandD_Who_Became_Politician=0 if OandD_Who_Became_Politician==.
replace OandD_Who_Became_Politician=1 if OandD_Who_Became_Politician>0& OandD_Who_Became_Politician<1
sort id
replace FascistaKeptPFY=. if Anno<1952
sort id
by id: egen FascistaKeptPF=max(FascistaKeptPFY)
by id: egen FascistaDepartedPF=max(FascistaDeparted)
replace FascistaKeptPF=0 if FascistaKeptPF==.
replace FascistaDepartedPF=0 if FascistaDepartedPF==.
summarize FascistaKeptPF FascistaDepartedPF
/*Fascista departed is now the fraction of former fascist O&Ds that leave the firm by 1952. Fascista kept is the fraction of former fascist O&Ds who are still O&Ds in the firm in 1952 or after*/
replace AventinoDisqualified1926=1  if AventinoDisqualified1926>0& AventinoDisqualified1926<1
replace FascistbasedoncourtsPFY=1 if FascistbasedoncourtsPFY>0& FascistbasedoncourtsPFY<1
replace Eligible=1 if Eligible>0& Eligible<1
replace FascistSenatorPFY=1 if FascistSenatorPFY >0& FascistSenatorPFY <1
replace SenatorPFY=1 if SenatorPFY >0& SenatorPFY <1
replace FascistDeputyPFY=1 if FascistDeputyPFY >0& FascistDeputyPFY <1
replace FascistaPFY=1 if FascistaPFY >0& FascistaPFY <1
replace Politician_SenatoFileOrQualifica   =1 if Politician_SenatoFileOrQualifica>0& Politician_SenatoFileOrQualifica<1
   	
sort id Anno
by id Anno: egen IneligibleFY=max(FascistbasedoncourtsPFY)
by id: egen IneligibleF=max(FascistbasedoncourtsPFY)
by id Anno: egen EligibleFY=max(Eligible)
by id: egen EligibleF=max(Eligible)
by id Anno: egen FascistSenatorFY= max(FascistSenatorPFY)
by id: egen FascistSenatorF= max(FascistSenatorPFY)
by id Anno: egen SenatorFY= max(SenatorPFY)
by id: egen SenatorF= max(SenatorPFY)
by id Anno: egen FascistDeputyFY= max(FascistDeputyPFY)
by id: egen FascistDeputyF= max(FascistDeputyPFY)
by id Anno: egen FascistaFY= max(FascistaPFY) 
by id: egen FascistaF= max(FascistaPFY)
by id Anno: egen PoliticianFY= max(Politician_SenatoFileOrQualifica) 
by id: egen PoliticianF= max(Politician_SenatoFileOrQualifica)

drop After
gen After=0
replace After=1 if Anno>1943
gen IneligibleFAfter = IneligibleF*After
gen EligibleFAfter =EligibleF*After
gen FascistaFAfter=FascistaF*After
gen FascistDeputyFAfter=FascistDeputyF*After
gen FascistSenatorFAfter= FascistSenatorF *After
gen PoliticianAfter= PoliticianF*After
save "C:\Papers\New papers\John Cronyism\Italy\SocietaItalianeConnectionsFirmLevel.dta", replace
clear
